package net.wofly.right.service;

import java.util.List;

import net.wofly.common.util.ReturnBean;
import net.wofly.right.domain.ReceivingAddr;

public interface IReceivingAddrService {

	/**
	 * 增加或修改
	 * 
	 * @param entity
	 * @return
	 */
	public ReceivingAddr save(ReceivingAddr entity);

	/**
	 * 删除
	 * 
	 * @param entity
	 * @return
	 */
	public void delete(ReceivingAddr entity);

	/**
	 * 根据主键ID删除
	 * 
	 * @param key
	 * @return
	 */
	public void delete(String key);

	/**
	 * 根据主键查询
	 * 
	 * @param key
	 * @return
	 */
	public ReceivingAddr findOne(String key);
	
	public List<ReceivingAddr> save(List<ReceivingAddr> entityList) ;
	
	public List<ReceivingAddr> findByUserID(String customerID);
	
	Integer countByUserIDAndStatus(String userID, Integer status);

	public List<ReceivingAddr> findByUserIDAndStatusOrderByDefaultFlagDesc(String customerID, Integer status);
	
	/**
	 *
	 * @param receivingAddr
	 */
	public ReturnBean<ReceivingAddr> addReceivingAddr(ReceivingAddr receivingAddr);
	
	/**
	 *
	 * @param receivingAddrID
	 */
	public ReturnBean<String> delReceivingAddr(String receivingAddrID);
	
	/**
	 *
	 * @param customerID
	 */
	public ReturnBean<List<ReceivingAddr>> getUserReceivingAddr(String customerID);
	
	/**
	 * 更新收货地址
	 * 
	 * 不可以直接覆盖原收货地址。需要把原收货地址置为无效，并重新添加一个收货地址。
	 * 否则引用此地址的订单收货地址会发生了变化。
	 *
	 *
	 * @param receivingAddr
	 */
	public ReturnBean<ReceivingAddr> updateReceivingAddr(ReceivingAddr receivingAddr);
	
	/**
	 * 设置地址是否为默认地址标志
	 * 
	 * 
	 * @param receivingAddrID
	 * @param defaultFlag
	 * @return
	 */
	public ReturnBean<ReceivingAddr> setDefaultReceivingAddr(String receivingAddrID ,Integer defaultFlag) ;
}
